package com.treasure.web.service;

import com.treasure.common.types.Corp;
import com.treasure.common.model.UploadDocumentRequest;
import com.treasure.infrastructure.model.po.KnowledgeBase;
import com.baomidou.mybatisplus.extension.service.IService;
import com.treasure.infrastructure.model.po.KnowledgeDocumentVector;
import com.treasure.web.command.request.KnowledgeDocumentOperateRequest;
import com.treasure.web.command.request.KnowledgeDocumentRequest;
import com.treasure.web.command.response.DocumentDownloadResponse;
import com.treasure.web.command.response.KnowledgeDocumentResponse;
import com.treasure.web.command.response.KnowledgeDocumentVectorResponse;
import com.treasure.web.command.response.KnowledgeRepositoryResponse;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author sunhongmin
 * @since 2023-08-31
 */
public interface IKnowledgeBaseService extends IService<KnowledgeBase> {

    /**
     * 获取知识库列表
     *
     * @return
     */
    List<KnowledgeRepositoryResponse> getKnowledgeRepositoryList(Corp corpId);

    /**
     * 获取知识库文档列表
     *
     * @param corpId
     * @param knowledgeDocumentRequest
     * @return
     */
    List<KnowledgeDocumentResponse> getDocumentList(Corp corpId, KnowledgeDocumentRequest knowledgeDocumentRequest);

    /**
     * 知识库上传文档
     *
     * @param file
     * @param uploadDocumentRequest
     * @return
     */
    KnowledgeDocumentResponse uploadDocument(MultipartFile file, UploadDocumentRequest uploadDocumentRequest) throws IOException;


    /**
     * 文档删除
     *
     * @param knowledgeDocumentDeleteRequest
     */
    void deleteDocument(KnowledgeDocumentOperateRequest knowledgeDocumentDeleteRequest);

    /**
     * 文档检索
     *
     * @param knowledgeDocumentDeleteRequest
     * @return
     */
    List<KnowledgeDocumentVectorResponse> getDocumentVectors(KnowledgeDocumentOperateRequest knowledgeDocumentDeleteRequest);

    /**
     * 文档下载
     *
     * @param knowledgeDocumentDeleteRequest
     * @return
     */
    DocumentDownloadResponse downloadDocument(KnowledgeDocumentOperateRequest knowledgeDocumentDeleteRequest) throws IOException;
}
